class Animal:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print(self.name + " is eating")

    def sleep(self):
        print(self.name + " is sleeping")


class Dog(Animal):

    def __init__(self, name,color):
        super().__init__(name)  #  调用父类的构造方法
        self.color = color

    def bark(self):
        print(self.color + "的" + self.name + " is barking")

if __name__ == '__main__':

    dog = Dog("旺财", "白色")
    print(dog.name) # 从父类继承的属性
    dog.eat()
    dog.sleep()
    dog.bark()